// mircoApp/ai-tongue-diagnosis/ai_tongue_diagnosis_joinMember/ai_tongue_diagnosis_joinMember.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    chooseInd: 0,
    yz_specs_show: false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.getData();
    let language = wx.getStorageSync("langIndex");
    this.setData({
      language: language.en,
    })
  },
  yz_specs_showTap() {
    if (this.data.info.goods_widget.length <= 0) {
      return
    }
    this.setData({
      yz_specs_show: true
    })
  },
  async closeSpecsPopup(e) {
    let {
      cartid,
      clicktype,
      goodsCount,
      goodsId,
      optionsId
    } = e.detail;
    if (clicktype == 0) {
      this.setData({
        yz_specs_show: false,
      })
      return
    }
    wx.navigateTo({
      url: `/packageD/buy/myOrder_v2/myOrder_v2?goodsId=${goodsId}&optionsId=${optionsId?optionsId:''}&total=${goodsCount}&tag=-2&mark=&fromStock=`,
    })
    return
    // let _json = {
    //   member_coupon_ids: "[]",
    //   orders: "[]",
    //   address: [],
    //   dispatch_type_id: 0,
    //   mark: 0,
    //   goods: ''
    // };
    // let params = [{
    //   goods_id: goodsId,
    //   total: goodsCount,
    //   option_id: optionsId
    // }]
    // _json.goods = JSON.stringify(params);
    // console.log(_json)
    // let {
    //   data
    // } = await app._postNetWork({
    //   url: app.getNetAddresss("order.create"),
    //   data: _json
    // })
    // if (data.result) {
    //   wx.redirectTo({
    //     url: `/packageD/buy/orderPay/orderPay?order_id=${data.data.order_ids}&status=2&tag=ai-tongue-diagnosis&name=ai-tongue-diagnosis`,
    //   })
    // } else {
    //   app.tips(data.msg);
    // }
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  },
  async getData() {
    app._postNetWork({
      url: app.getNetAddresss("plugin.ai-tongue-diagnosis.frontend.controllers.index.join-member"),
      success: (res) => {
        console.log(res)
        let data = res.data;
        if (data.result) {
          this.setData({
            info: data.data
          })
        } else {
          app.tips(data.msg);
        }
      }
    })
  },
  tapChooseTab(e) {
    let {
      index
    } = e.currentTarget.dataset;
    this.setData({
      chooseInd: index
    })
  },
  tapShow() {
    this.setData({
      show: true
    })
  },
  onClose() {
    this.setData({
      show: false
    })
  }
})